package com.wf.LeetCode;

/**
 * @author mpk
 * @since 2024/6/12 20:07:07
 */
public class AccountBalanceAfterPurchase {
    public static void main(String[] args) {

        System.out.println(accountBalanceAfterPurchase(10));
        System.out.println(accountBalanceAfterPurchase(15));
        System.out.println(accountBalanceAfterPurchase(27));
        System.out.println(accountBalanceAfterPurchase(23));
        System.out.println(accountBalanceAfterPurchase(56));

    }

    public static int accountBalanceAfterPurchase(int purchaseAmount) {

        double i = purchaseAmount / 10.0;
        int j = purchaseAmount / 10;


        if (i % 1 >= 0.5) {
            return 100-(j + 1) * 10;
        }
        return 100-j*10;
    }

}
